package com.huike.web.controller.report;


import com.huike.report.domain.vo.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.huike.common.core.domain.AjaxResult;
import com.huike.report.service.IReportService;

import java.util.List;

@RestController
@RequestMapping("/index")
public class IndexController {

    @Autowired
    private IReportService reportService;


    /**
     * 首页--基础数据统计
     * @param beginCreateTime
     * @param endCreateTime
     * @return
     */
    @GetMapping("/getBaseInfo")
    public AjaxResult getBaseInfo(@RequestParam("beginCreateTime") String beginCreateTime,
                                  @RequestParam("endCreateTime") String endCreateTime){
        return AjaxResult.success(reportService.getBaseInfo(beginCreateTime,endCreateTime));
    }
    /**
     * @description: 首页--今日基础数据统计
     * @return: com.huike.common.core.domain.AjaxResult
     * @author: ShaJianBao
     * @date: 2022/9/5 15:05
     */
    @GetMapping("/getTodayInfo")
    public AjaxResult getTodayInfo(){
        IndexTodayInfo info = reportService.getTodayInfo();
        IndexTodayInfoVO indexTodayInfoVO = new IndexTodayInfoVO();
        BeanUtils.copyProperties(info,indexTodayInfoVO);
        return AjaxResult.success(indexTodayInfoVO);
    }
    /**
     * @description: 首页--代办
     * @param: beginCreateTime
     * @param: endCreateTime
     * @return: com.huike.common.core.domain.AjaxResult
     * @author: ShaJianBao
     * @date: 2022/9/6 19:13
     */
    @GetMapping("/getTodoInfo")
    public AjaxResult getTodayInfoByDateTime(@RequestParam("beginCreateTime")String beginCreateTime,
                                             @RequestParam("endCreateTime")String endCreateTime){
        IndexTodoInfo todoInfo = reportService.getTodoInfo(beginCreateTime, endCreateTime);
        IndexTodoInfoVO indexTodoInfoVO = new IndexTodoInfoVO();
        BeanUtils.copyProperties(todoInfo,indexTodoInfoVO);
        return AjaxResult.success(indexTodoInfoVO);
    }
    @GetMapping("/businessChangeStatistics")
    public AjaxResult getBusinessChangeStatistics(@RequestParam("beginCreateTime")String beginCreateTime,
                                                  @RequestParam("endCreateTime")String endCreateTime){
        List<BusinessStatic> list= reportService.getBusinessChangeStatistics(beginCreateTime,endCreateTime);
        return null;
    }



}